3.37 \(\int (f+g x)^2 (a+b \log (c (d+e x)^n)) \, dx\)

Optimal. Leaf size=120 \[ \frac{(f+g x)^3 \left (a+b \log \left (c (d+e x)^n\right )\right )}{3 g}-\frac{b n x (e f-d g)^2}{3 e^2}-\frac{b n (e f-d g)^3 \log (d+e x)}{3 e^3 g}-\frac{b n (f+g x)^2 (e f-d g)}{6 e g}-\frac{b n (f+g x)^3}{9 g} \]

[Out]

-(b*(e*f - d*g)^2*n*x)/(3*e^2) - (b*(e*f - d*g)*n*(f + g*x)^2)/(6*e*g) - (b*n*(f + g*x)^3)/(9*g) - (b*(e*f - d
*g)^3*n*Log[d + e*x])/(3*e^3*g) + ((f + g*x)^3*(a + b*Log[c*(d + e*x)^n]))/(3*g)

________________________________________________________________________________________

Rubi [A]  time = 0.0544044, antiderivative size = 120, normalized size of antiderivative = 1., number of steps used = 3, number of rules used = 2, integrand size = 22, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.091, Rules used = {2395, 43} \[ \frac{(f+g x)^3 \left (a+b \log \left (c (d+e x)^n\right )\right )}{3 g}-\frac{b n x (e f-d g)^2}{3 e^2}-\frac{b n (e f-d g)^3 \log (d+e x)}{3 e^3 g}-\frac{b n (f+g x)^2 (e f-d g)}{6 e g}-\frac{b n (f+g x)^3}{9 g} \]

Antiderivative was successfully verified.

[In]

Int[(f + g*x)^2*(a + b*Log[c*(d + e*x)^n]),x]

[Out]

-(b*(e*f - d*g)^2*n*x)/(3*e^2) - (b*(e*f - d*g)*n*(f + g*x)^2)/(6*e*g) - (b*n*(f + g*x)^3)/(9*g) - (b*(e*f - d
*g)^3*n*Log[d + e*x])/(3*e^3*g) + ((f + g*x)^3*(a + b*Log[c*(d + e*x)^n]))/(3*g)

Rule 2395

Int[((a_.) + Log[(c_.)*((d_) + (e_.)*(x_))^(n_.)]*(b_.))*((f_.) + (g_.)*(x_))^(q_.), x_Symbol] :> Simp[((f + g
*x)^(q + 1)*(a + b*Log[c*(d + e*x)^n]))/(g*(q + 1)), x] - Dist[(b*e*n)/(g*(q + 1)), Int[(f + g*x)^(q + 1)/(d +
 e*x), x], x] /; FreeQ[{a, b, c, d, e, f, g, n, q}, x] && NeQ[e*f - d*g, 0] && NeQ[q, -1]

Rule 43

Int[((a_.) + (b_.)*(x_))^(m_.)*((c_.) + (d_.)*(x_))^(n_.), x_Symbol] :> Int[ExpandIntegrand[(a + b*x)^m*(c + d
*x)^n, x], x] /; FreeQ[{a, b, c, d, n}, x] && NeQ[b*c - a*d, 0] && IGtQ[m, 0] && ( !IntegerQ[n] || (EqQ[c, 0]
&& LeQ[7*m + 4*n + 4, 0]) || LtQ[9*m + 5*(n + 1), 0] || GtQ[m + n + 2, 0])

Rubi steps

\begin{align*} \int (f+g x)^2 \left (a+b \log \left (c (d+e x)^n\right )\right ) \, dx &=\frac{(f+g x)^3 \left (a+b \log \left (c (d+e x)^n\right )\right )}{3 g}-\frac{(b e n) \int \frac{(f+g x)^3}{d+e x} \, dx}{3 g}\\ &=\frac{(f+g x)^3 \left (a+b \log \left (c (d+e x)^n\right )\right )}{3 g}-\frac{(b e n) \int \left (\frac{g (e f-d g)^2}{e^3}+\frac{(e f-d g)^3}{e^3 (d+e x)}+\frac{g (e f-d g) (f+g x)}{e^2}+\frac{g (f+g x)^2}{e}\right ) \, dx}{3 g}\\ &=-\frac{b (e f-d g)^2 n x}{3 e^2}-\frac{b (e f-d g) n (f+g x)^2}{6 e g}-\frac{b n (f+g x)^3}{9 g}-\frac{b (e f-d g)^3 n \log (d+e x)}{3 e^3 g}+\frac{(f+g x)^3 \left (a+b \log \left (c (d+e x)^n\right )\right )}{3 g}\\ \end{align*}

Mathematica [A]  time = 0.142426, size = 150, normalized size = 1.25 \[ \frac{e \left (x \left (6 a e^2 \left (3 f^2+3 f g x+g^2 x^2\right )-b n \left (6 d^2 g^2-3 d e g (6 f+g x)+e^2 \left (18 f^2+9 f g x+2 g^2 x^2\right )\right )\right )+6 b e \left (3 d f^2+e x \left (3 f^2+3 f g x+g^2 x^2\right )\right ) \log \left (c (d+e x)^n\right )\right )+6 b d^2 g n (d g-3 e f) \log (d+e x)}{18 e^3} \]

Antiderivative was successfully verified.

[In]

Integrate[(f + g*x)^2*(a + b*Log[c*(d + e*x)^n]),x]

[Out]

(6*b*d^2*g*(-3*e*f + d*g)*n*Log[d + e*x] + e*(x*(6*a*e^2*(3*f^2 + 3*f*g*x + g^2*x^2) - b*n*(6*d^2*g^2 - 3*d*e*
g*(6*f + g*x) + e^2*(18*f^2 + 9*f*g*x + 2*g^2*x^2))) + 6*b*e*(3*d*f^2 + e*x*(3*f^2 + 3*f*g*x + g^2*x^2))*Log[c
*(d + e*x)^n]))/(18*e^3)

________________________________________________________________________________________

Maple [C]  time = 0.508, size = 585, normalized size = 4.9 \begin{align*} \text{result too large to display} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((g*x+f)^2*(a+b*ln(c*(e*x+d)^n)),x)

[Out]

-1/2*g*b*f*n*x^2-1/3/e^2*g^2*b*d^2*n*x-b*f^2*n*x+1/3/e^3*g^2*ln(e*x+d)*b*d^3*n+1/3*(g*x+f)^3*b/g*ln((e*x+d)^n)
-1/9*g^2*b*n*x^3+g*a*f*x^2+a*f^2*x-1/3/g*ln(e*x+d)*b*f^3*n+g*ln(c)*b*f*x^2+1/3*g^2*a*x^3+ln(c)*b*f^2*x+1/3*g^2
*ln(c)*b*x^3+1/e*ln(e*x+d)*b*d*f^2*n-1/2*I*Pi*b*f^2*x*csgn(I*c*(e*x+d)^n)^3-1/6*I*g^2*Pi*b*x^3*csgn(I*c*(e*x+d
)^n)^3+1/6/e*g^2*b*d*n*x^2-1/6*I*g^2*Pi*b*x^3*csgn(I*c)*csgn(I*(e*x+d)^n)*csgn(I*c*(e*x+d)^n)+1/2*I*g*Pi*b*f*x
^2*csgn(I*c)*csgn(I*c*(e*x+d)^n)^2+1/2*I*g*Pi*b*f*x^2*csgn(I*(e*x+d)^n)*csgn(I*c*(e*x+d)^n)^2-1/2*I*Pi*b*f^2*x
*csgn(I*c)*csgn(I*(e*x+d)^n)*csgn(I*c*(e*x+d)^n)+1/e*g*b*d*f*n*x-1/e^2*g*ln(e*x+d)*b*d^2*f*n+1/6*I*g^2*Pi*b*x^
3*csgn(I*c)*csgn(I*c*(e*x+d)^n)^2-1/2*I*g*Pi*b*f*x^2*csgn(I*c)*csgn(I*(e*x+d)^n)*csgn(I*c*(e*x+d)^n)+1/6*I*g^2
*Pi*b*x^3*csgn(I*(e*x+d)^n)*csgn(I*c*(e*x+d)^n)^2-1/2*I*g*Pi*b*f*x^2*csgn(I*c*(e*x+d)^n)^3+1/2*I*Pi*b*f^2*x*cs
gn(I*c)*csgn(I*c*(e*x+d)^n)^2+1/2*I*Pi*b*f^2*x*csgn(I*(e*x+d)^n)*csgn(I*c*(e*x+d)^n)^2

________________________________________________________________________________________

Maxima [A]  time = 1.26443, size = 252, normalized size = 2.1 \begin{align*} \frac{1}{3} \, b g^{2} x^{3} \log \left ({\left (e x + d\right )}^{n} c\right ) + \frac{1}{3} \, a g^{2} x^{3} - b e f^{2} n{\left (\frac{x}{e} - \frac{d \log \left (e x + d\right )}{e^{2}}\right )} + \frac{1}{18} \, b e g^{2} n{\left (\frac{6 \, d^{3} \log \left (e x + d\right )}{e^{4}} - \frac{2 \, e^{2} x^{3} - 3 \, d e x^{2} + 6 \, d^{2} x}{e^{3}}\right )} - \frac{1}{2} \, b e f g n{\left (\frac{2 \, d^{2} \log \left (e x + d\right )}{e^{3}} + \frac{e x^{2} - 2 \, d x}{e^{2}}\right )} + b f g x^{2} \log \left ({\left (e x + d\right )}^{n} c\right ) + a f g x^{2} + b f^{2} x \log \left ({\left (e x + d\right )}^{n} c\right ) + a f^{2} x \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((g*x+f)^2*(a+b*log(c*(e*x+d)^n)),x, algorithm="maxima")

[Out]

1/3*b*g^2*x^3*log((e*x + d)^n*c) + 1/3*a*g^2*x^3 - b*e*f^2*n*(x/e - d*log(e*x + d)/e^2) + 1/18*b*e*g^2*n*(6*d^
3*log(e*x + d)/e^4 - (2*e^2*x^3 - 3*d*e*x^2 + 6*d^2*x)/e^3) - 1/2*b*e*f*g*n*(2*d^2*log(e*x + d)/e^3 + (e*x^2 -
 2*d*x)/e^2) + b*f*g*x^2*log((e*x + d)^n*c) + a*f*g*x^2 + b*f^2*x*log((e*x + d)^n*c) + a*f^2*x

________________________________________________________________________________________

Fricas [B]  time = 2.16382, size = 474, normalized size = 3.95 \begin{align*} -\frac{2 \,{\left (b e^{3} g^{2} n - 3 \, a e^{3} g^{2}\right )} x^{3} - 3 \,{\left (6 \, a e^{3} f g -{\left (3 \, b e^{3} f g - b d e^{2} g^{2}\right )} n\right )} x^{2} - 6 \,{\left (3 \, a e^{3} f^{2} -{\left (3 \, b e^{3} f^{2} - 3 \, b d e^{2} f g + b d^{2} e g^{2}\right )} n\right )} x - 6 \,{\left (b e^{3} g^{2} n x^{3} + 3 \, b e^{3} f g n x^{2} + 3 \, b e^{3} f^{2} n x +{\left (3 \, b d e^{2} f^{2} - 3 \, b d^{2} e f g + b d^{3} g^{2}\right )} n\right )} \log \left (e x + d\right ) - 6 \,{\left (b e^{3} g^{2} x^{3} + 3 \, b e^{3} f g x^{2} + 3 \, b e^{3} f^{2} x\right )} \log \left (c\right )}{18 \, e^{3}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((g*x+f)^2*(a+b*log(c*(e*x+d)^n)),x, algorithm="fricas")

[Out]

-1/18*(2*(b*e^3*g^2*n - 3*a*e^3*g^2)*x^3 - 3*(6*a*e^3*f*g - (3*b*e^3*f*g - b*d*e^2*g^2)*n)*x^2 - 6*(3*a*e^3*f^
2 - (3*b*e^3*f^2 - 3*b*d*e^2*f*g + b*d^2*e*g^2)*n)*x - 6*(b*e^3*g^2*n*x^3 + 3*b*e^3*f*g*n*x^2 + 3*b*e^3*f^2*n*
x + (3*b*d*e^2*f^2 - 3*b*d^2*e*f*g + b*d^3*g^2)*n)*log(e*x + d) - 6*(b*e^3*g^2*x^3 + 3*b*e^3*f*g*x^2 + 3*b*e^3
*f^2*x)*log(c))/e^3

________________________________________________________________________________________

Sympy [A]  time = 3.95086, size = 277, normalized size = 2.31 \begin{align*} \begin{cases} a f^{2} x + a f g x^{2} + \frac{a g^{2} x^{3}}{3} + \frac{b d^{3} g^{2} n \log{\left (d + e x \right )}}{3 e^{3}} - \frac{b d^{2} f g n \log{\left (d + e x \right )}}{e^{2}} - \frac{b d^{2} g^{2} n x}{3 e^{2}} + \frac{b d f^{2} n \log{\left (d + e x \right )}}{e} + \frac{b d f g n x}{e} + \frac{b d g^{2} n x^{2}}{6 e} + b f^{2} n x \log{\left (d + e x \right )} - b f^{2} n x + b f^{2} x \log{\left (c \right )} + b f g n x^{2} \log{\left (d + e x \right )} - \frac{b f g n x^{2}}{2} + b f g x^{2} \log{\left (c \right )} + \frac{b g^{2} n x^{3} \log{\left (d + e x \right )}}{3} - \frac{b g^{2} n x^{3}}{9} + \frac{b g^{2} x^{3} \log{\left (c \right )}}{3} & \text{for}\: e \neq 0 \\\left (a + b \log{\left (c d^{n} \right )}\right ) \left (f^{2} x + f g x^{2} + \frac{g^{2} x^{3}}{3}\right ) & \text{otherwise} \end{cases} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((g*x+f)**2*(a+b*ln(c*(e*x+d)**n)),x)

[Out]

Piecewise((a*f**2*x + a*f*g*x**2 + a*g**2*x**3/3 + b*d**3*g**2*n*log(d + e*x)/(3*e**3) - b*d**2*f*g*n*log(d +
e*x)/e**2 - b*d**2*g**2*n*x/(3*e**2) + b*d*f**2*n*log(d + e*x)/e + b*d*f*g*n*x/e + b*d*g**2*n*x**2/(6*e) + b*f
**2*n*x*log(d + e*x) - b*f**2*n*x + b*f**2*x*log(c) + b*f*g*n*x**2*log(d + e*x) - b*f*g*n*x**2/2 + b*f*g*x**2*
log(c) + b*g**2*n*x**3*log(d + e*x)/3 - b*g**2*n*x**3/9 + b*g**2*x**3*log(c)/3, Ne(e, 0)), ((a + b*log(c*d**n)
)*(f**2*x + f*g*x**2 + g**2*x**3/3), True))

________________________________________________________________________________________

Giac [B]  time = 1.21388, size = 581, normalized size = 4.84 \begin{align*} \frac{1}{3} \,{\left (x e + d\right )}^{3} b g^{2} n e^{\left (-3\right )} \log \left (x e + d\right ) -{\left (x e + d\right )}^{2} b d g^{2} n e^{\left (-3\right )} \log \left (x e + d\right ) +{\left (x e + d\right )} b d^{2} g^{2} n e^{\left (-3\right )} \log \left (x e + d\right ) - \frac{1}{9} \,{\left (x e + d\right )}^{3} b g^{2} n e^{\left (-3\right )} + \frac{1}{2} \,{\left (x e + d\right )}^{2} b d g^{2} n e^{\left (-3\right )} -{\left (x e + d\right )} b d^{2} g^{2} n e^{\left (-3\right )} +{\left (x e + d\right )}^{2} b f g n e^{\left (-2\right )} \log \left (x e + d\right ) - 2 \,{\left (x e + d\right )} b d f g n e^{\left (-2\right )} \log \left (x e + d\right ) + \frac{1}{3} \,{\left (x e + d\right )}^{3} b g^{2} e^{\left (-3\right )} \log \left (c\right ) -{\left (x e + d\right )}^{2} b d g^{2} e^{\left (-3\right )} \log \left (c\right ) +{\left (x e + d\right )} b d^{2} g^{2} e^{\left (-3\right )} \log \left (c\right ) - \frac{1}{2} \,{\left (x e + d\right )}^{2} b f g n e^{\left (-2\right )} + 2 \,{\left (x e + d\right )} b d f g n e^{\left (-2\right )} + \frac{1}{3} \,{\left (x e + d\right )}^{3} a g^{2} e^{\left (-3\right )} -{\left (x e + d\right )}^{2} a d g^{2} e^{\left (-3\right )} +{\left (x e + d\right )} a d^{2} g^{2} e^{\left (-3\right )} +{\left (x e + d\right )} b f^{2} n e^{\left (-1\right )} \log \left (x e + d\right ) +{\left (x e + d\right )}^{2} b f g e^{\left (-2\right )} \log \left (c\right ) - 2 \,{\left (x e + d\right )} b d f g e^{\left (-2\right )} \log \left (c\right ) -{\left (x e + d\right )} b f^{2} n e^{\left (-1\right )} +{\left (x e + d\right )}^{2} a f g e^{\left (-2\right )} - 2 \,{\left (x e + d\right )} a d f g e^{\left (-2\right )} +{\left (x e + d\right )} b f^{2} e^{\left (-1\right )} \log \left (c\right ) +{\left (x e + d\right )} a f^{2} e^{\left (-1\right )} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((g*x+f)^2*(a+b*log(c*(e*x+d)^n)),x, algorithm="giac")

[Out]

1/3*(x*e + d)^3*b*g^2*n*e^(-3)*log(x*e + d) - (x*e + d)^2*b*d*g^2*n*e^(-3)*log(x*e + d) + (x*e + d)*b*d^2*g^2*
n*e^(-3)*log(x*e + d) - 1/9*(x*e + d)^3*b*g^2*n*e^(-3) + 1/2*(x*e + d)^2*b*d*g^2*n*e^(-3) - (x*e + d)*b*d^2*g^
2*n*e^(-3) + (x*e + d)^2*b*f*g*n*e^(-2)*log(x*e + d) - 2*(x*e + d)*b*d*f*g*n*e^(-2)*log(x*e + d) + 1/3*(x*e +
d)^3*b*g^2*e^(-3)*log(c) - (x*e + d)^2*b*d*g^2*e^(-3)*log(c) + (x*e + d)*b*d^2*g^2*e^(-3)*log(c) - 1/2*(x*e +
d)^2*b*f*g*n*e^(-2) + 2*(x*e + d)*b*d*f*g*n*e^(-2) + 1/3*(x*e + d)^3*a*g^2*e^(-3) - (x*e + d)^2*a*d*g^2*e^(-3)
 + (x*e + d)*a*d^2*g^2*e^(-3) + (x*e + d)*b*f^2*n*e^(-1)*log(x*e + d) + (x*e + d)^2*b*f*g*e^(-2)*log(c) - 2*(x
*e + d)*b*d*f*g*e^(-2)*log(c) - (x*e + d)*b*f^2*n*e^(-1) + (x*e + d)^2*a*f*g*e^(-2) - 2*(x*e + d)*a*d*f*g*e^(-
2) + (x*e + d)*b*f^2*e^(-1)*log(c) + (x*e + d)*a*f^2*e^(-1)